﻿using System.Xml.Linq;

using Fozzy.Ontology;

namespace Fozzy.Gedcom
{
    /// <summary>
    /// One family group. 
    /// </summary>
    [XAlias("DIV")]
    [XLevel(1)]
    public class Divorce                                        : Fozzy.Being.Divorce
    {
        #region fields
        #endregion

        #region States

        #endregion

        #region Properties
            public override Fozzy.Name                        Name            { get { return new Name("Y", base.Name)                          ; } }
        #endregion

        #region Constructeur

            public Divorce(Fozzy.Time.Date date)                : base(date)
            {}
            public Divorce(_Element node)                        : base(node)
            {}

        #endregion

        //Export :
        //    // Divorce.
        //    if (relationship.SpouseModifier == SpouseModifier.Former)
        //    {
        //        WriteLine(1, "DIV", "Y");

        //        // Date if it exist.
        //        if (relationship.DivorceDate != null) WriteLine(2, "DATE", relationship.DivorceDate.Value.ToShortDateString());
        //    }
        //}

            //public override void Export()
            //{
            //    base.Export()                                           ;
            //    Normal.Export()                                         ;
            //    new Date(Start).Export()                                ;
            //}

            ///// <summary>
            ///// Update the marriage / divorce information for the two people.
            ///// </summary>
            //private static void ImportMarriage(Person husband, Person wife, XmlNode node)
            //{
            //    // Return right away if there are not two people.
            //    if (husband == null || wife == null)
            //        return;

            //    // See if a marriage (or divorce) is specified.
            //    if (node.SelectSingleNode("MARR") != null || node.SelectSingleNode("DIV") != null)
            //    {
            //        // Get dates.
            //        DateTime? marriageDate = GetValueDate(node, "MARR/DATE");
            //        DateTime? divorceDate = GetValueDate(node, "DIV/DATE");
            //        SpouseModifier modifier = GetDivorced(node) ? SpouseModifier.Former : SpouseModifier.Current;

            //        // Add info to husband.
            //        if (husband.GetSpouseRelationship(wife) == null)
            //        {
            //            SpouseRelationship husbandMarriage = new SpouseRelationship(wife, modifier);
            //            husbandMarriage.MarriageDate = marriageDate;
            //            husbandMarriage.DivorceDate = divorceDate;
            //            husband.Relationships.Add(husbandMarriage);
            //        }

            //        // Add info to wife.
            //        if (wife.GetSpouseRelationship(husband) == null)
            //        {
            //            SpouseRelationship wifeMarriage = new SpouseRelationship(husband, modifier);
            //            wifeMarriage.MarriageDate = marriageDate;
            //            wifeMarriage.DivorceDate = divorceDate;
            //            wife.Relationships.Add(wifeMarriage);
            //        }
            //    }
            //}

    }
}
